package com.zbx.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DB2Connection {
	public static final String DB2Driver="com.ibm.db2.jcc.DB2Driver";
//	public static final String URL="jdbc:db2://88.100.6.30:50000/statdata";
	public static final String URL="jdbc:db2://192.168.6.233:50000/statdata";
	public static final String USERNAME="statdata";
	public static final String PASSWORD="statdata";
	
	public static Connection conn=null; 
	
	public static Connection getConn() throws  SQLException{
		try {
			Class.forName(DB2Driver).newInstance();
			conn=DriverManager.getConnection(URL,USERNAME,PASSWORD);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return conn;
	}
	
	public static void main(String[] args){
		try {
			getConn();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
